import React from 'react';
import { connect } from 'dva';
import { createForm } from 'rc-form';
import { List, Icon, TextareaItem,Toast } from 'antd-mobile';
import { ToastTips } from '../../../../../../common/toastTips/tosat';
import styles from './addAppraise.css';
import CustBtn from '../../../../../../common/buttons/Btn';
import content from '../../../../common/contentCss/content.css';
import CustTitle from '../../../../common/title/title';

const addAppraise = ({

  selfEvaluate,
  onSubmit=()=>{},
  form: { getFieldProps, getFieldsValue, validateFields },

}) => {

  const titleProps = {
    titleName:'个人评价',
    showSaveBtnStatus: true,
    saveBtnName: '保存',
    goBack(){
      history.go(-1);
    },
    onSave(){
      console.log('保存个人评价')
      validData()
    },
  }
  const validData = () => {
    validateFields((error, value) => {
      // console.log(error, value);
      if (error) {
        for (var i in error) {
          error[i].errors.map(e => ToastTips(e.message, 2000, null))
        }
        return;
      } else {
        // Toast.info('已提交', 1.5)
        console.log(1);
        onSubmit(value)
      }
      console.log('value', JSON.stringify(value))
    });
  }

  return (
    <div  className={content.content}>
      <CustTitle {...titleProps}/>
      <div style={{
        marginTop: '2.8125em',
      }}>
      </div>

      <div  className={styles.TextareaItem} >
        <TextareaItem cols={25} rows={8} placeholder="填写内容"
          {...getFieldProps('selfEvaluate',{
            initialValue: selfEvaluate,
            rules: [
              { required: false, message: '请输入个人评价' }
            ]
          })}
          count={150}
        />

      </div>



    </div>
  )
}


addAppraise.propTypes = {
};

export default createForm()(addAppraise);
